--First example for formatting result sets
--Colum aliases as column headers
USE AdventureWorks2008
GO
SELECT BusinessEntityID
FROM HumanResources.Employee;

SELECT BusinessEntityID
 AS "Employee Identification Number"
FROM HumanResources.Employee;



--Second example for formatting result sets
--Using string literals
USE AdventureWorks2008
GO
SELECT LastName, FirstName, MiddleName
FROM Person.Person
ORDER BY LastName, FirstName, MiddleName

SELECT (LastName + ', ' + FirstName + ' ' + SUBSTRING(MiddleName, 1, 1)) AS 'Name'
FROM Person.Person
ORDER BY LastName, FirstName, MiddleName


--Third example for formatting result sets
--Using expressions
USE AdventureWorks2008
GO
SELECT Name, ProductNumber, ListPrice AS OldPrice, (ListPrice * 1.1) AS NewPrice
FROM Production.Product
WHERE ListPrice > 0 AND (ListPrice/StandardCost) > .8


SELECT Name, ProductNumber, ListPrice AS OldPrice, (ListPrice * 1.1) AS NewPrice
FROM Production.Product
WHERE SellEndDate < GETDATE()
